home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / MPW / MPW cawf 4.0.9 / 00readme < prev    next >
Encoding:
Text File  |  1995-12-01  |  18.6 KB  |  550 lines  |  [TEXT/ttxt]

  1. Cawf - nroff-like text formatter
  2.  
  3. Cawf is a C version of awf, Henry Spencer's Amazingly Workable (text)
  4. Formatter.  (Awf is written in awk and appears in comp.sources.unix,
  5. Volume 23, Issue 27.)  Cawf and awf provide a usable subset of raw nroff
  6. capabilities and the styles of the man(7), me(7) (only cawf supports
  7. me(7)), and ms(7) macro sets.
  8.  
  9. One of cawf's virtues is that it will run on PC clones under MS-DOS or
  10. OS/2.  It will also run on the Apple Macintosh as a Macintosh Programmer's
  11. Workshop (MPW) tool.
  12.  
  13. Like awf, cawf is completely independent of any licensed Unix source
  14. code.  In comparison to awf, cawf supports more nroff functions and one
  15. more macro set, me(7).
  16.  
  17. This distribution contains: complete source; make files for Unix,
  18. Macintosh, MS-DOS, and OS/2; documentation; and executables (MS-DOS
  19. and Macintosh) for cawf and a companion output filter, bsfilt.
  20.  
  21. This is the version 4.09 distribution of cawf.  Changes since version
  22. 4.08 include:
  23.  
  24.     *  Matthias Ulrich Neeracher <neeri@iis.ee.ethz.ch> has
  25.        ported cawf 4.09 to the Macintosh, where it runs under
  26.        the Macintosh Programmer's Workshop (MPW) tool.
  27.        Information on his port may be found in the 00readme
  28.        file and in the mac_cawf sub-directory of the distribution.
  29.        Please direct questions about Macintosh cawf to Matthias.
  30.  
  31. Version 4.08 changes include:
  32.  
  33.     *  Some rudimentary output device support has been added,
  34.        via a device configuration file.
  35.  
  36.     *  The code has been converted to use unsigned characters.
  37.  
  38.     *  An attempt has been made to make the code ANSI C compliant.
  39.  
  40.     *  The following bugs have been fixed:
  41.  
  42.         A bug in the locating of the device file has been
  43.         corrected, so that the code performs as documented.
  44.  
  45.         Null macro arguments are ignored.
  46.  
  47.         Some unused arguments to local functions have been
  48.         more carefully type cast to avoid portability
  49.         problems.
  50.  
  51.     *  The .fl and .rn requests are now supported.
  52.  
  53.     *  Limited support has been added for the non-break request
  54.        control character, the acute accent (').
  55.  
  56.     *  Argument count conditionals -- operating on \n(.$ --
  57.        may now use the >= and <= operators in addition to [<=>].
  58.  
  59.     *  Macros may be terminated with "..", ".", "''" or "'".
  60.  
  61.     *  String interpolation is performed if it is specified at
  62.        the start of the defined value -- i.e., the string value
  63.        may be a request for interpolation of another string.
  64.  
  65.     *  In .ds string values "\\b" is converted to '\b' and
  66.        "\\\\"" is converted to '\\'.  No other sequence,
  67.        beginning with '\\', is modified.
  68.  
  69.     *  The .tr request has been enhanced to handle named
  70.        characters and string interpolation.
  71.  
  72.     *  The SS macro is now included in man.mac.
  73.  
  74.     *  The cawf version number is now displayed in the help
  75.        output.
  76.  
  77.     *  A limited -me macro set is included in me.mac.
  78.  
  79.     *  Some forms of the hyphen -- e.g., one of two `-' characters
  80.        at the start of a word or ME(7)'s \*- -- will now be
  81.        output in bold or italic face, if they're in effect.
  82.        See cawf(1) for a complete description of the rules of
  83.        hyphenation and the output of hyphen characters.
  84.  
  85.        A bug was corrected in the handling of the \*(em hyphen.
  86.  
  87.     *  Three part titles -- the .tl and .lt commands -- are
  88.        now supported.
  89.  
  90.     *  4.02 handles TABs better.
  91.  
  92.     *  4.03 handles NULL characters in font and device definitions
  93.        properly.
  94.  
  95.     *  4.04 changes include:
  96.  
  97.        o  The -n<starting_page_number> and -o<page_number_range>
  98.           options are supported.
  99.  
  100.        o  The current date is preset in the ME td string or
  101.           the MS DY string.
  102.  
  103.        o  The MS CH string is preset to "- % -" and the CH
  104.           string is preset to \*(DY.
  105.  
  106.        o  Some minor bug fixes were made.
  107.  
  108.           .  The binary search in the Nreq() function in nreq.c
  109.          is now constrained to the proper length.
  110.  
  111.           .  Null strings -- e.g., defined with ".ds xx" --
  112.          are now handled correctly.
  113.  
  114.     *  4.05 changes include:
  115.  
  116.        o  MS-DOS now uses the Borland C++ 3.1 compiler.
  117.           Accordingly:
  118.  
  119.           .  The bsfilt.mak and cawf.mak make files for MS
  120.          Quick C have been replaced by makefile.bcc.
  121.  
  122.           .  Some additional ANSI C purifications have been
  123.          performed.  (The _ANSI definition is now required
  124.          for Borland C++ 3.1.)
  125.  
  126.        o  Two new initialization directives are supported:
  127.  
  128.           .  .^b lf n 
  129.  
  130.          This directive sets the page footer section line
  131.          count to n-1.
  132.  
  133.           .  .^b lh n 
  134.  
  135.          This directive sets the page header section line
  136.          count to n.
  137.  
  138.            See cawf(1) for a more complete description of them.
  139.  
  140.     *  4.06 changes include:
  141.  
  142.        o  Header and footer strings may now contain some in-text
  143.           codes, including:
  144.  
  145.           .  Font specifications via \f;
  146.  
  147.           .  Number register interpolations via \n;
  148.  
  149.           .  String interpolations via \*;
  150.  
  151.           .  Escaping of other characters with \.
  152.  
  153.           See cawf(1) for a more complete description of the
  154.           header and footer controls.
  155.  
  156.        o  Some Borland C++ 3.1 source code dependencies are
  157.           now controlled under the _BCC #define.
  158.  
  159.        o  Hard spaces -- "\ " -- are handled better.
  160.  
  161.     *  4.07 changes include:
  162.  
  163.        o  Support was added for OS/2, using the Microsoft or
  164.           EMX GNU C compilers.  The __EMX__ definition selects
  165.           some code conditionally defined for the EMX GNU C
  166.           compiler.
  167.  
  168.           The OS/2 support was provided by Darrel Hankerson
  169.           <hankedr@mail.auburn.edu>.  Executables may be obtained
  170.           via anonymous ftp from ftp-os2.cdrom.com (192.153.46.2)
  171.           in pub/os2/all/unix/cawf4*.zip.  Please direct
  172.           questions about compiling and using cawf under OS/2
  173.           to Darrel.
  174.  
  175.     *  4.08 changes include:
  176.  
  177.        o  Handling of .ce was changed to flush any pending
  178.           output before centering takes place.   Mike Soyka
  179.           <mgs@ssd.ray.com> pointed out the need for this.
  180.  
  181.  
  182. CONTENTS
  183. --------
  184.  
  185. This Unix distribution of cawf includes:
  186.  
  187.     00readme    this file
  188.     00diffs         description of differences between cawf
  189.             and [nt]roff
  190.     *.c and *.h     source files to build cawf and bsfilt
  191.             (bsfilt removes Backspaces from cawf output)
  192.     bsfilt.1    nroff source for the bsfilt manual page
  193.     bsfilt.def      linker definition file for OS/2 16 bit
  194.             versions
  195.     bsfilt.exe    bsfilt executable for MS-DOS
  196.     bsfilt32.def    linker definition file for OS/2 32 bit
  197.             versions
  198.     cawf.1        nroff source for the cawf manual page
  199.     cawf.def        linker definition file for OS/2 16 bit
  200.             versions
  201.     cawf.exe    cawf executable for MS-DOS
  202.     cawf32.def      linker definition file for OS/2 32 bit
  203.             versions
  204.     common        initialization file for CAWFLIB library
  205.     device.cf       output device configuration file for CAWFLIB
  206.             library
  207.     dumb.dev    device description file for CAWFLIB library
  208.     Makefile    Unix-style make file
  209.     mac_cawf        a subdirectory of Macintosh-related files
  210.             for cawf, including:
  211.               Makefile.mk     MPW make file
  212.               bsfilt.bin     bsfilt fat binary
  213.               cawf.bin     cawf fat binary
  214.               cawf.r     textual resources for cawf
  215.               cawf.rsrc.bin     cursors for cawf
  216.               macish.c     Toolbox initialization
  217.     makefile.bcc    Borland C++ 3.1 command-line make file
  218.     makefile.os2    makefile for Microsoft C and EMX GNU C
  219.             (mostly for OS/2, but will produce DOS
  220.             executables, too)
  221.     man.mac        man(7) macros for CAWFLIB library
  222.     me.mac        me(7) macros for CAWFLIB library
  223.     ms.mac        ms(7) macros for CAWFLIB library
  224.     strcasecmp.c    the strcasecmp() function from BSD4.3 (See
  225.             the discussion under STRCASECMP for
  226.             information on when you might need to use
  227.             this.)
  228.  
  229.  
  230. LIBRARY
  231. -------
  232.  
  233. To use cawf, you must select a location for the CAWFLIB library
  234. files.  The distributed cawf.exe expects to find them in c:\sys\lib\cawf,
  235. but you can alter that with the CAWFLIB environment variable, or
  236. you can change the CAWFLIB #define in cawf.h and rebuild cawf from
  237. the sources.
  238.  
  239. CAWFLIB contains a minimum of six files:
  240.  
  241.     common          common raw nroff commands to get cawf
  242.             started
  243.  
  244.     dumb.dev        a set of character definitions for a plain,
  245.             "dumb" ASCII device - e. g., the console
  246.             display, a CRT or a basic line printer
  247.  
  248.     device.cf    the output device configuration file
  249.     man.mac        the man(7) macros
  250.     me.mac        the me(7) macros
  251.     ms.mac        the ms(7) macros
  252.  
  253. You may want to add your own macro files to the library.  Just name
  254. them "m[your-name].mac", following the usual nroff naming convention
  255. for macro files.
  256.  
  257. If you have fancy output devices with special character specifications,
  258. you may want to generate new *.dev files for them.  Follow the
  259. format of dumb.dev in making new character specifications.
  260.  
  261. To define characters for a new device, select a name prefix for it
  262. and create a file in CAWFLIB with the name "<prefix>.dev".  To use
  263. the new file, set the TERM environment variable to <prefix> - e.g.,
  264. when I test cawf on Unix, I need a vt100.dev, because my TERM
  265. environment variable value is usually vt100.  All I do is make
  266. vt100.dev a symbolic link to dumb.dev.  Even that isn't even
  267. necessary, because cawf will use dumb.dev if it can't find TERM.dev.
  268.  
  269. In addition to the character specifications possible through the
  270. *.dev files, cawf provides one-time font selection and bold or
  271. italic face support for output devices via its -d and -f options.
  272. Cawf can be directed to issue specific device codes for bold and
  273. italic characters, and one font can be specified for the entire
  274. document.  Cawf has some built-in output device support, and
  275. additional support is contained in the device configuration file,
  276. device.cf.  Additional devices may be defined in device.cf.
  277.  
  278. It is not necessary to generate a new *.dev file for each output
  279. device definition.  Only when you need special character definitions
  280. do you need to create a *.dev file.  The dumb.dev file is adequate
  281. for most devices you define in device.cf.
  282.  
  283.  
  284. SOURCES
  285. -------
  286.  
  287. A Unix make file and a make file for Borland's C++ 3.1 compiler
  288. are included.  The Unix make file has some definitions that help
  289. tune it to the local Unix environment:
  290.  
  291.     _ANSI           must be defined for Borland C++ 3.1 to
  292.             effect proper function prototype declarations.
  293.  
  294.     _BCC            must be defined to use Borland C++ #pragma
  295.             statements.
  296.  
  297.     CAWFLIB         is a string that can be used in lieu of
  298.             changes to cawf.h's CAWFLIB #define.
  299.  
  300.     __EMX__         must be defined when using the EMX GNU C
  301.             compiler (usually under OS/2).  You must
  302.             also use the special make file, makefile.os2.
  303.             See the OS/2 INFORMATION section.
  304.  
  305.     macintosh    must be defined when build cawf under the
  306.             Macintosh Programmer's Workshop (MPW) on
  307.             the Apple Macintosh.  The UNIX and USG
  308.             definitions are also required.
  309.  
  310.     MALLOCH         is a string that should be defined when a
  311.             UNIX environment has a <malloc.h>, unless
  312.             it also has a <stdlib.h> with prototypes
  313.             for malloc() and its relatives.  In the
  314.             latter case, you should define STDLIB, but
  315.             you don't need to define MALLOCH.
  316.  
  317.     STDLIB          indicates that standard library function
  318.             prototype definitions may be found in
  319.             <stdlib.h>.
  320.  
  321.             STDLIB must be defined for Borland C++
  322.  
  323.             If STDLIB is not defined, the cawf sources
  324.             try to define their own library function
  325.             return values.
  326.  
  327.     __STR__         The definition of this string must be
  328.             deleted when using the xlc 1.2 compiler on
  329.             the RISC/System 6000 under AIX 3.2.  Put
  330.  
  331.                 -U__STR__
  332.  
  333.             in the Makefile DEFS string.  This must be
  334.             done because the xlc 1.2 compiler does not
  335.             correctly inline string functions when
  336.             compiling pass3.c.
  337.  
  338.     UNIX            switches the build environment to Unix.
  339.             You may also have to decide about MALLOCH,
  340.             STDLIB, __STR__ and USG when you define
  341.             UNIX.
  342.  
  343.             Do not define UNIX for Borland C++ 3.1; do
  344.             define _ANSI and STDLIB.
  345.  
  346.     USG             adjusts for System V.  (UNIX must also be
  347.             defined.)
  348.  
  349.             You may also need to define USG to select
  350.             the proper header file for string function
  351.             prototypes.  If UNIX and USG are defined,
  352.             "proto.h" selects <string.h>; if only UNIX,
  353.             <strings.h>.  Cawf needs the more complete
  354.             set of definitions, including strchr() and
  355.             strrchr().  If <string.h> #includes
  356.             <strings.h>, as is sometimes the case,
  357.             define only UNIX.
  358.  
  359. I have built and tested cawf in the UNIX context under AIX 3.2 (see
  360. the note above on __STR__), BSD4.3-Tahoe, Sequent DYNIX, ETAV (SYSV
  361. 3.0), NeXTStep 3.0, SunOS 4.1.1 and Ultrix 2.2.  If you build under
  362. another Unix variant, you may have to adjust the source code, header
  363. files and Makefile to fit.  Check the Makefile first for hints.
  364.  
  365.  
  366. STRCASECMP
  367. ----------
  368.  
  369. Some platforms don't provide the strcasecmp() or strcmpi() functions
  370. for case-insensitive string comparisons.  Strcasecmp() is used
  371. several times in the Defdev() function of the device.c module.
  372. Strcasecmp() is redefined in device.c to be stricmp() for the EMX
  373. GNU C compiler for OS/2, and strcmpi() for other non-UNIX compilers,
  374. including Borland C++ 3.1.
  375.  
  376. If you don't have either function in your run-time library, consider
  377. using the strcasecmp() function in the enclosed strcasecmp.c file.
  378. It is freely distributable, subject to the restrictions noted in
  379. its comments.  You may have to modify the code slightly -- Chet
  380. Creider reports that the Xenix C compiler in the 2.3.0 Development
  381. System (based on Microsoft C 5.0) doesn't accept the "const" keyword,
  382. while the 2.3.1 compiler (based on Microsoft C 5.1) does.  If you
  383. have a 2.3.0 system, remove the "const" keywords from strcasecmp.c
  384. before compiling it.
  385.  
  386.  
  387. ANSI C COMPLIANCE
  388. -----------------
  389.  
  390. Some effort has been devoted to making the cawf sources ANSI C
  391. compliant.  The header file proto.h contains function prototypes
  392. that enable ANSI C argument checking.  The state of definition of
  393. the __STDC__ symbol is used to select options that depend on strict
  394. adherence to the ANSI C standard -- e.g., the need for the isascii()
  395. test before islower() or isupper().  If your ANSI compiler doesn't
  396. define this variable when it's acting in strict ANSI C mode, you
  397. may have to define it in the Makefile.
  398.  
  399. The Borland C++ 3.1 compiler must have the _ANSI symbol defined
  400. for proper function prototype handling.
  401.  
  402.  
  403. OS/2 INFORMATION
  404. ----------------
  405.  
  406. Cawf has been ported to OS/2.  The lastest round of porting was
  407. done by Darrel Hankerson <hankedr@mail.auburn.edu>.  I do not
  408. include OS/2 executables and cannot give OS/2 assistance, because
  409. I do not have an OS/2 test platform.  Executables may be obtained
  410. via anonymous ftp from ftp-os2.cdrom.com (192.153.46.2) in
  411. pub/os2/all/unix/cawf4*.zip.  Please direct questions about compiling
  412. and using cawf under OS/2 to Darrel.
  413.  
  414. Here's a note from Darrel:
  415.  
  416.     The "emxbnd" target will produce an executable which runs under
  417.     both OS/2 2.x and DOS (32-bit), but requires run-time support
  418.     from the emx distribution (available from ftp-os2.cdrom.com).
  419.     It is possible to include the runtime support in the executable,
  420.     in order to simplify the installation (at the price of larger
  421.     executables).  The 16-bit "mscbnd" exe will run under all
  422.     versions of OS/2 and DOS.
  423.  
  424.  
  425. MS-DOS AND OS/2 SHELL CONSIDERATIONS
  426. ------------------------------------
  427.  
  428. The MS-DOS version of cawf was created to run under the KornShell
  429. of the Mortis Kern Systems Toolkit.  One ramification of using MKS'
  430. ksh is that it supports the separate standard error and standard
  431. output streams.  Hence, cawf blithely distributes its error messages
  432. to the standard error file, and assumes the user's shell is capable
  433. of separating them from standard output.
  434.  
  435. If you don't use the MKS KornShell, but do want to separate the
  436. output streams, you'll have to modify the cawf source code, or
  437. obtain a shell that does.  As a rudimentary aid to the modification
  438. process, cawf uses a separate stream pointer, Efs, for writing
  439. error output, but sets it to stderr.  You can change that process
  440. to open a separate error file and set Efs to point to it.
  441.  
  442. There are several freely distributed shells that will separate
  443. standard error and standard output streams.  Look for versions of
  444. ksh, bash and Stewartson's sh for OS/2 1.x, OS/2 2.x, and MS-DOS
  445. on ftp-os2.cdrom.com (192.153.46.2).
  446.  
  447.  
  448. MACINTOSH CONSIDERATIONS
  449. ------------------------
  450.  
  451. Cawf was ported to the Macintosh by Matthias Ulrich Neeracher
  452. <neeri@iis.ee.ethz.ch>.  If you have specific questions about the
  453. port, please direct them to Matthias.
  454.  
  455. The Macintosh version of cawf was created to run under MPW, the
  456. Macintosh Programmer's Workshop.  The tools are fat binaries, and
  457. thus on a PowerMac, at least version 3.4 beta is required.
  458.  
  459. To compile cawf on a Mac, you need the Metrowerks CodeWarrior 7
  460. MPW compilers, CWGUSI, and dmake. CWGUSI and dmake are available
  461. from:
  462.  
  463.     ftp://ftp.switch.ch/software/mac/src/mw_c/CWGUSI_164.sit.bin
  464.     ftp://ftp.switch.ch/software/mac/src/mpw_c/dmake-401.sit.bin
  465.  
  466.  
  467. MACINTOSH INSTALLATION
  468. ----------------------
  469.  
  470. To install cawf:
  471.  
  472.     *  Depending on how you unpack the distribution, some of
  473.        the files might still be in MacBinary format.  Convert
  474.        them with StuffIt Expander or some other tool.
  475.  
  476.     *  Place the files cawf and bsfilt in the Tools folder in
  477.        your MPW folder.  You may find these files in the mac_cawf
  478.        subdirectory of your distribution with a .bin suffix on
  479.        them.  Remove the suffix when you place them in the
  480.        Tools folder of your MPW folder.
  481.  
  482.     *  Create a folder named cawf in the Interfaces folder of
  483.        your MPW Folder and copy the following files into it:
  484.  
  485.        o  common
  486.        o  dumb.dev
  487.        o  device.cf
  488.        o  man.mac
  489.        o  me.mac
  490.        o  ms.mac
  491.  
  492.  
  493. SPECIAL CONSIDERATIONS FOR MACINTOSH SOURCES
  494. --------------------------------------------
  495.  
  496. Macintosh specific passages are bracketed with the pre-processor
  497. directives:
  498.  
  499.     #if    defined(macintosh)
  500.     #else    /* !defined(macintosh) */
  501.     #endif    /* defined(macintosh) */
  502.  
  503. Makefile.mk in the mac_cawf subdirectory of the distribution defines
  504. the macintosh symbol.  It also defines the UNIX and USG symbols.
  505.  
  506. Don't forget to move cawf.r, Makefile.mk, and macish.c from the
  507. mac_cawf subdirectory to its parent directory (where the rest of
  508. the cawf sources reside) before building cawf.
  509.  
  510.  
  511. COPYRIGHTS AND CREDITS
  512. ----------------------
  513.  
  514. The sources are copyrighted, but freely distributable under usual
  515. terms -- retention of credit, etc.
  516.  
  517. Please acknowledge:
  518.  
  519.     AT&T for their public-domain release of getopt(3) at the
  520.     1985 UNIFORUM conference;
  521.  
  522.     Chet Creider, Bob Hardy and Ted Campbell for their
  523.     contributions to font filtering;
  524.  
  525.     Darrel Hankerson for the OS/2 port.  (Kai Uwe Rommel
  526.     <rommel@ars.muc.de> did the original port of cawf to OS/2.)
  527.  
  528.     Matthias Ulrich Neeracher for the Macintosh port.
  529.  
  530.     Henry Spencer for awf and his regular expression package;
  531.  
  532.     Andy Tanenbaum for his help in ANSI C compliance, including
  533.     his ansi.h header file from Minix;
  534.  
  535.     Ed Tankus for suggesting useful feature additions;
  536.  
  537. Henry says about awf, "I can't believe I really wrote this."  Those
  538. are my sentiments exactly about cawf, but I also understand that
  539. necessity sometimes forces us to do what we would prefer to avoid.
  540.  
  541.  
  542. BUGS AND ENHANCEMENTS
  543. ---------------------
  544.  
  545. I'll be glad to hear about bugs and needs for enhancements, but
  546. make no promises about delivering fixes or upgrades in response.
  547.  
  548. Vic Abell <abe@cc.purdue.edu>
  549. December 1, 1995
  550.